import { FormItemOption } from 'custom/custom/FormItem'
import { DateRangePicker, NumberRange, OptionSelect, ApiSelect, OptionRadio, RateItem, UploadImage, CityPicker } from '@/components/form-item'
export default class FormItems {
  // 日期选择
  static datePicker(option: FormItemOption): FormItemOption {
    return {
      tag: 'ElDatePicker',
      format: "YYYY-MM-DD",
      valueFormat: "YYYY-MM-DD",
      ...option
    }
  }

  // 日期范围选择
  static dateRangePicker(option) {
    return {
      tag: DateRangePicker,
      format: "YYYY-MM-DD",
      valueFormat: "YYYY-MM-DD",
      type: 'daterange',
      ...option
    }
  }

  // 时间选择
  static dateTimePicker(option: FormItemOption): FormItemOption {
    return {
      tag: 'ElDatePicker',
      format: "YYYY-MM-DD HH:mm:ss",
      valueFormat: "YYYY-MM-DD HH:mm:ss",
      ...option
    }
  }

  // 时间范围选择
  static dateTimeRangePicker(option) {
    return {
      tag: DateRangePicker,
      format: "YYYY-MM-DD HH:mm:ss",
      valueFormat: "YYYY-MM-DD HH:mm:ss",
      type: 'datetimerange',
      ...option
    }
  }

  // 数字范围选择
  static numberRangePicker(option) {
    return {
      tag: NumberRange,
      ...option
    }
  }

  // select选择器
  static optionSelect(option) {
    return {
      tag: OptionSelect,
      ...option
    }
  }

  // 远程数据select
  static apiSelect(option) {
    return {
      tag: ApiSelect,
      ...option
    }
  }

  static optionRadio(option) {
    return {
      tag: OptionRadio,
      ...option
    }
  }

  static rateItem(option) {
    return {
      tag: RateItem,
      ...option
    }
  }

  // 上传图片
  static uploadImage(option) {
    return {
      tag: UploadImage,
      ...option
    }
  }

  // 选择城市
  static cityPicker(option) {
    return {
      tag: CityPicker,
      ...option
    }
  }
}
